using System.ComponentModel.DataAnnotations;

namespace MonitorPlatform.Data.Entities
{
    public class ErrorLog : BaseEntity
    {
        [Required]
        [StringLength(50)]
        public string AppId { get; set; } = string.Empty;

        [Required]
        [StringLength(100)]
        public string SessionId { get; set; } = string.Empty;

        [StringLength(100)]
        public string? UserId { get; set; }

        [StringLength(100)]
        public string? ProcessingId { get; set; }

        public DateTime Timestamp { get; set; }

        [Required]
        [StringLength(50)]
        public string ErrorType { get; set; } = string.Empty;

        [Required]
        public string ErrorMessage { get; set; } = string.Empty;

        public string? StackTrace { get; set; }

        [StringLength(500)]
        public string? FileName { get; set; }

        public int? LineNumber { get; set; }
        public int? ColumnNumber { get; set; }

        [StringLength(500)]
        public string? Url { get; set; }

        [StringLength(500)]
        public string? UserAgent { get; set; }

        [StringLength(500)]
        public string? Referrer { get; set; }

        // JavaScript Error Details
        public string? ComponentStack { get; set; }
        public string? ErrorBoundary { get; set; }

        // Network Error Details
        [StringLength(500)]
        public string? ApiUrl { get; set; }

        [StringLength(10)]
        public string? HttpMethod { get; set; }

        public int? StatusCode { get; set; }
        public string? ResponseBody { get; set; }

        // Error Resolution
        public bool IsResolved { get; set; } = false;
        public DateTime? ResolvedAt { get; set; }

        [StringLength(100)]
        public string? ResolvedBy { get; set; }

        public string? ResolutionNotes { get; set; }

        // Error Severity and Impact
        public string Severity { get; set; } = "Low";
        public int Impact { get; set; } = 1;

        // Additional Context
        public string? AdditionalData { get; set; }

        // Navigation properties
        public virtual Application Application { get; set; } = null!;
    }
} 